/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ADMINISTRADOR
 */
@Entity
@Table(name = "col_tipocolegiado")
//@NamedQueries({@NamedQuery(name = "TipoColegiado.findAll", query = "SELECT t FROM TipoColegiado t"), @NamedQuery(name = "TipoColegiado.findByTcoCodigo", query = "SELECT t FROM TipoColegiado t WHERE t.tcoCodigo = :tcoCodigo"), @NamedQuery(name = "TipoColegiado.findByTcoNombre", query = "SELECT t FROM TipoColegiado t WHERE t.tcoNombre = :tcoNombre"), @NamedQuery(name = "TipoColegiado.findByTcoActivo", query = "SELECT t FROM TipoColegiado t WHERE t.tcoActivo = :tcoActivo")})
public class TipoColegiado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tco_codigo")
    private Integer tcoCodigo;
    @Basic(optional = false)
    @Column(name = "tco_nombre")
    private String tcoNombre;
    @Basic(optional = false)
    @Column(name = "tco_activo")
    private boolean tcoActivo;
    
    @OneToMany(mappedBy = "tipoColegiado", fetch = FetchType.LAZY)
    private List<Colegiado> colegiadoCollection;

    public TipoColegiado() {
    }

    public TipoColegiado(Integer tcoCodigo) {
        this.tcoCodigo = tcoCodigo;
    }

    public TipoColegiado(Integer tcoCodigo, String tcoNombre, boolean tcoActivo) {
        this.tcoCodigo = tcoCodigo;
        this.tcoNombre = tcoNombre;
        this.tcoActivo = tcoActivo;
    }

    public Integer getTcoCodigo() {
        return tcoCodigo;
    }

    public void setTcoCodigo(Integer tcoCodigo) {
        this.tcoCodigo = tcoCodigo;
    }

    public String getTcoNombre() {
        return tcoNombre;
    }

    public void setTcoNombre(String tcoNombre) {
        this.tcoNombre = tcoNombre;
    }

    public boolean getTcoActivo() {
        return tcoActivo;
    }

    public void setTcoActivo(boolean tcoActivo) {
        this.tcoActivo = tcoActivo;
    }

    public List<Colegiado> getColegiadoCollection() {
        return colegiadoCollection;
    }

    public void setColegiadoCollection(List<Colegiado> colegiadoCollection) {
        this.colegiadoCollection = colegiadoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tcoCodigo != null ? tcoCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoColegiado)) {
            return false;
        }
        TipoColegiado other = (TipoColegiado) object;
        if ((this.tcoCodigo == null && other.tcoCodigo != null) || (this.tcoCodigo != null && !this.tcoCodigo.equals(other.tcoCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.TipoColegiado[tcoCodigo=" + tcoCodigo + "]";
    }

}
